package rss;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import orest.back.membermanage.UserManagerSql;

import net.ssta.common.Constants;
import net.ssta.core.base.ServletBase;
import net.ssta.core.db.DBConnectionProvider;
import net.ssta.core.db.DataBaseExecutor;
import net.ssta.core.db.RecordSet;
import net.ssta.core.web.RequestKit;

public class RssServlet extends ServletBase {

	protected void defaultAction(HttpServletRequest request, HttpServletResponse response) throws IOException
	{
		rssList(request,response);
	}
	
	
	
	/**
     * 获取用户技术需求列表
     * 
     * @param request
     * @param response
     */
    public void rssList(HttpServletRequest request,
        HttpServletResponse response)
    {
    	try {
    		RequestKit kit =new RequestKit(request);
		    String siteId=kit.getParameter("siteId","0");
			RecordSet rs=null;
			Connection conn = null;
	    	try {
	    		
	    		conn = DBConnectionProvider.getConnection(Constants.JNDI_SSTA);
		    	DataBaseExecutor dbe = DataBaseExecutor.getExecutor(conn);
		        String sql="SELECT * FROM V_CMS_CHANNEL WHERE (rss='0' OR rss is null) and (BILL=0 OR BILL IS NULL) AND SITE_ID="+siteId+"";
		    	rs=dbe.find(sql);
		    	
			} catch (SQLException e) {
				throw e;
			}finally{
				try{
					if(conn != null) conn.close();
				}catch (SQLException e){
					 
				}
			}
		    request.setAttribute("RECORDSET", rs);
		    this.forward("/common/rssList.jsp");
		   
		} catch (IOException e) {
			e.printStackTrace();
		}catch (Exception e) {
			e.printStackTrace();
		}
    }
	
}